Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transparency option #540

Open
wants to merge 49 commits into
base: v4.9.0
Choose a base branch
from

Conversation

EastArctica
Copy link
Contributor

@EastArctica EastArctica commented Aug 22, 2023

This PR adds a transparency button into settings. This has been confirmed tested on Manjaro linux as well as I believe tested on Windows although that should be double checked.

Things of note:

  • In src/main/index.ts, we manually get the replugged settings. This is needed in order for the launcher to know whether to launch supporting transparency or not. This should be moved elsewhere or done differently however I would like some input on it.
  • This does not apply to the splash screen. If/When Implement splash themes #523 is implemented, that should be added.
  • Currently there is not translation key for REPLUGGED_SETTINGS_TRANSPARENT or REPLUGGED_SETTINGS_TRANSPARENT_DESC. After speaking with @asportnoy, we determined that the various issues with having transparency should be noted per platform instead of all together as they were pre-swc.
  • The settings is currently under advanced settings, however I suppose there is no reason for this to be and it should be moved out and into the general settings.

If anyone encounters any bugs with this please let me know!

src/main/index.ts Outdated Show resolved Hide resolved
src/renderer/coremods/settings/pages/General.tsx Outdated Show resolved Hide resolved
@EastArctica
Copy link
Contributor Author

Opinions on these translation keys? The linux/windows one would be used depending on which platform you're on.

REPLUGGED_SETTINGS_TRANSPARENT: `Transparent Window`
REPLUGGED_SETTINGS_TRANSPARENT_DESC: `Makes the discord window transparent, primarily useful for theming.`
REPLUGGED_SETTINGS_TRANSPARENT_ISSUES_WINDOWS: `****WARNING:**** This will break **window snapping**. In some cases, you may experience a black background, such as when the window is cut off at the top or bottom due of the monitor resolution, or when the development tools are open and docked. **Requires restart**.`
REPLUGGED_SETTINGS_TRANSPARENT_ISSUES_LINUX: `****WARNING:**** **Hardware acceleration** may need to be turned **off**. In some cases, you may experience a black background, such as when the window is cut off at the top or bottom due of the monitor resolution, or when the development tools are open and docked. **Requires restart**.`

@asportnoy asportnoy changed the base branch from main to v4.7.0 August 23, 2023 00:41
@asportnoy asportnoy added enhancement New feature or request semver: minor Requires a minor semver version bump labels Aug 23, 2023
@asportnoy asportnoy added this to the v4.7.0 milestone Aug 23, 2023
@EastArctica
Copy link
Contributor Author

Should be all set, needs testing on windows and macos and then a review.

@EastArctica
Copy link
Contributor Author

Confirmed working on windows after minor issues, just need test on macos.

@EastArctica EastArctica requested a review from asportnoy August 23, 2023 03:47
@asportnoy asportnoy marked this pull request as draft September 16, 2023 18:10
@asportnoy asportnoy removed this from the v4.7.0 milestone Sep 16, 2023
@asportnoy asportnoy changed the base branch from v4.7.0 to v4.8.0 October 12, 2023 01:37
Require discord restart for transparency change

Move transparency button

move readSettingsSync to src/util.mts

At platform specific notices

Fix transparency on Windows

BrowserWindow rework

MacOS Auto-Maximize
@EastArctica
Copy link
Contributor Author

EastArctica commented Mar 11, 2024

Fixed some issues, looks like blur isn't possible with neither the native setBackgroundMaterial nor @pyke/vibe on canary (electron 28)

@EastArctica
Copy link
Contributor Author

EastArctica commented Mar 11, 2024

This pr is not ready to be merged.

Copy link
Contributor

@zrodevkaan zrodevkaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nuh uh

@EastArctica
Copy link
Contributor Author

If anyone would like to take this over please just let me know.

@FedeIlLeone FedeIlLeone deleted the branch replugged-org:v4.9.0 November 21, 2024 20:39
@FedeIlLeone FedeIlLeone reopened this Nov 21, 2024
@FedeIlLeone FedeIlLeone changed the base branch from v4.8.0 to v4.9.0 November 21, 2024 20:45
@EastArctica
Copy link
Contributor Author

Example video of it working: https://zipline.eastarcti.ca/u/KgFiYH.mp4
Minimum needed for the transparency effect to trigger (Please note this does not mean the minimum needed for you to see transparency):

:root {
  --window-background-material: "acrylic";
  --window-background-color: #00000000;
}

html, body {
  background: transparent;
}

Example theme using acrylic https://github.com/EastArctica/replugged-nord-transparent/releases/tag/v1.0.3

@Ren0X1
Copy link
Contributor

Ren0X1 commented Jan 15, 2025

maybe we can do something listening the resize event from the BrowserWindow object something like this:

window.on('resize', () => {
  window.webContents.send('resize-event');
});

we also have the maximize unmaximize and minimize events
https://www.electronjs.org/docs/latest/api/browser-window

@EastArctica
Copy link
Contributor Author

EastArctica commented Jan 16, 2025

@Ren0X1 This probably isn't what you meant but while looking into it the latest commit changes the way maximize/unmaximize is done in a few ways but seems to prevent the window from visually being at pixel 1,1 (sometimes) while still fixing the grey background as well as making the maximize experience a little bit cleaner.

If anyone knows/can figure out how to unmaximize when dragged while in the maximized state cleanly please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver: minor Requires a minor semver version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants